package com.reggie.mapper;

import com.reggie.pojo.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {
    @Select("SELECT * FROM shopping_cart WHERE user_id=#{userId}")
    List<ShoppingCart> findAll(Long userId);

    @Insert("INSERT INTO shopping_cart(id, name, image, user_id, dish_id, setmeal_id, dish_flavor, number, amount, create_time) " +
            "VALUES(#{id}, #{name}, #{image}, #{userId}, #{dishId}, #{setmealId}, #{dishFlavor}, #{number}, #{amount}, now())")
    Integer add(ShoppingCart shoppingCart);

    Integer edit(ShoppingCart shoppingCart);

    ShoppingCart find(ShoppingCart shoppingCart);

    Integer delete(ShoppingCart shoppingCart);
}
